cmake_minimum_required(VERSION 2.8)

#project name
project(tests)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fno-rtti")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

#set(ANDROID_SDK_PATH "/home/gj/projects/rk3568-new")
set(ANDROID_SDK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/rk3568_android11_sdk")

include_directories(
	${ANDROID_SDK_PATH}/frameworks/native/include
	${ANDROID_SDK_PATH}/frameworks/native/libs/nativewindow/include
	${ANDROID_SDK_PATH}/frameworks/native/libs/ui/include
	${ANDROID_SDK_PATH}/frameworks/native/libs/nativebase/include
	${ANDROID_SDK_PATH}/frameworks/native/libs/binder/include
	${ANDROID_SDK_PATH}/frameworks/native/libs/binder/ndk/include_ndk
	${ANDROID_SDK_PATH}/frameworks/native/libs/binder/ndk/include_platform
	${ANDROID_SDK_PATH}/system/core/include
	${ANDROID_SDK_PATH}/system/core/base/include
	${ANDROID_SDK_PATH}/system/libhidl/base/include
	${ANDROID_SDK_PATH}/system/libhidl/transport/include
	${ANDROID_SDK_PATH}/system/libhidl/transport/token/1.0/utils/include
	${ANDROID_SDK_PATH}/hardware/libhardware/include
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/common/aidl/android.hardware.graphics.common-ndk_platform-source/gen/include
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/common/1.0/android.hardware.graphics.common@1.0_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/common/1.1/android.hardware.graphics.common@1.1_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/common/1.2/android.hardware.graphics.common@1.2_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/bufferqueue/1.0/android.hardware.graphics.bufferqueue@1.0_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/graphics/bufferqueue/2.0/android.hardware.graphics.bufferqueue@2.0_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/hardware/interfaces/media/1.0/android.hardware.media@1.0_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/system/libhidl/transport/base/1.0/android.hidl.base@1.0_genc++_headers/gen
	${ANDROID_SDK_PATH}/out/soong/.intermediates/system/libhidl/transport/manager/1.0/android.hidl.manager@1.0_genc++_headers/gen
	${CMAKE_CURRENT_SOURCE_DIR}
    )

link_directories(
	${ANDROID_SDK_PATH}/lib
)

#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/ TEST_SRCS)
#message(${CMAKE_CURRENT_SOURCE_DIR})
if(CMAKE_BUILD_TYPE STREQUAL Debug)
#set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
else()
#set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
endif()

#add_library(trmpp STATIC ${TEST_SRCS})
#add_library(trmpp SHARED ${TEST_SRCS})

#target_link_libraries(trmpp
#    libthirdparty.a
#    pthread
#    dl
#    rt
#)

#build mpp test
#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/examples MPP_DEMO_SRCS)
#set(MPP_DEMO_SRCS
#    examples/mpp_test.c)

#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/examples/common MPP_DEMO_SRCS)
#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/examples/vdec MPP_DEMO_SRCS)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/debug)
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/debug)
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
else()
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/release)
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
endif()

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/out)

add_executable(test_client ${CMAKE_CURRENT_SOURCE_DIR}/client.cpp)
add_executable(test_server ${CMAKE_CURRENT_SOURCE_DIR}/server.cpp)

target_link_libraries(test_client
	ui
	gui
	android
	log
	binder
	utils
    )

target_link_libraries(test_server
	ui
	gui
	android
	log
	binder
	utils
    )